﻿@using System.Text
@using System.Xml

@using WebMarkupMin.Sample.AspNet4.WebPages2
@using WebMarkupMin.Sample.Logic.Models

@{
	Layout = null;

	const string contentType = "text/xml";
	Encoding contentEncoding = Encoding.UTF8;

	Uri siteUrl = UrlHelper.GetSiteUrl();
	var sitemapItems = new List<SitemapItem>
	{
		new SitemapItem(UrlHelper.GetAbsolutePageUrl(siteUrl, "/"), null, SitemapChangeFrequency.Hourly, 0.9),
		new SitemapItem(UrlHelper.GetAbsolutePageUrl(siteUrl, "/ChangeLog"), null, SitemapChangeFrequency.Daily, 0.8),
		new SitemapItem(UrlHelper.GetAbsolutePageUrl(siteUrl, "/Contact"), null, SitemapChangeFrequency.Weekly, 0.4)
	};
	var sitemap = new WebMarkupMin.Sample.Logic.Models.Sitemap(sitemapItems);

	Response.ContentType = contentType;
	Response.ContentEncoding = contentEncoding;

	var settings = new XmlWriterSettings()
	{
		Encoding = contentEncoding,
		// Add indents in order to test the XML minification
		Indent = true
	};

	using (XmlWriter writer = XmlWriter.Create(Response.Output, settings))
	{
		sitemap.GetXmlSitemapFormatter().WriteXml(writer);
	}
}